package org.nudt.video.controller

import org.nudt.common.model.Danmaku
import org.nudt.common.model.ResponseData
import org.nudt.video.service.DanmakuService
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/v1/danmaku")
class DanmakuController(private val danmakuService: DanmakuService) {
    
    /**
     * 获取所有弹幕列表
     */
    @GetMapping("/{vid}/list")
    fun getTypeList(@PathVariable vid: String): ResponseData<List<Danmaku>> {
        return ResponseData.success(danmakuService.getDanmakusByVid(vid))
    }
    
    @PostMapping("/send")
    fun sendDanmaku(@RequestBody danmaku: Danmaku): ResponseData<Danmaku> {
        return ResponseData.success(danmakuService.insertDanmaku(danmaku))
    }
}